package acceptTests;

import exceptions.database.NonAssessableDatabaseException;
import sessionManager.SessionManager;
import sessionManager.SessionManagerIF;
import user.UserIF;
import user.profile.ProfileFacade;

/**
 * Fa�ade class used for SessionManager's acceptance tests.
 * 
 * @author cassioscabral@gmail.com
 * 
 */
public class US02Facade {

	private SessionManagerIF sessionManagerInstance = SessionManager
			.getInstance();

	public String logon(String login, String senha) throws Exception {
		return sessionManagerInstance.loginUser(login, senha);

	}

	public boolean isUserLogged(String login) throws Exception {
		return sessionManagerInstance.isUserLogged(login);

	}

	public void logoff(String idSession) throws Exception {
		sessionManagerInstance.logoffUser(idSession);
	}

	public void loadData() throws NonAssessableDatabaseException {

		sessionManagerInstance.loadData();

	}
	
	public String getProfileInformationBySessionId(String idSession, String atributo) throws Exception{
		UserIF u = sessionManagerInstance.getUser(idSession);
		ProfileFacade pf = new ProfileFacade(u.getProfile());
		return pf.getProfileInformation(atributo);
		
	}
}
